<template>
    <div class="bnh-wallet-container">
        <div class="bnh-wallet-head">
            <p class="allCont">总收益 <span>{{allMoney}}</span> 元</p>
        </div>
        <div class="bnh-yue-box">
            <p class="wallet-title">可提余额</p>
            <p class="yue"><span>{{balance}}</span> 元</p>
            <div class="bnh-yue-btn flex flex-align-center flex-pack-center"><p>提现</p></div>
        </div>
        <div style="height:2.8rem"></div>
        <!-- 收益列表 -->
        <div class="bnh-wallet-list">
            <div class="bnh-list-head border flex flex-align-center">
            <p class="bnh-pieBox-title flex-1">收益记录</p>
            <div class="bnh-genduobox flex flex-align-center" @click="onWalletlist">
                <p>更多</p>
                <img src="@/assets/img/right.png" alt="">
            </div>
            </div>
            <div class="bnh-list-item border flex flex-align-center" v-for='item in BalanceList'>
                <p class="leixin flex-1">经销商奖励</p>
                <div class="tipsBox">
                    <p>2018-03-13 12:30</p>
                    <p class="wallet-cont">+100</p>
                </div>
            </div>
        </div>
        <NavBottom></NavBottom>
    </div>
</template>
<script>
import NavBottom from '../components/NavBottom'
import http from '../utils/http'
import api from '../utils/api'
import utils from '../utils/utils'
export default {
    created(){ //页面初始化时修改网页标题
			window.document.title = '钱包';
            this.$store.state.Index = 4;
            this.getallMoney();
            this.getBalanceList();
   },
  components:{
      NavBottom
  },
  data(){
      return{
          allMoney: '0.00', // 总收益
          balance:'0.00', // 余额
          BalanceList:[], //收益列表
      }
  },
  methods:{
      onWalletlist(){
           this.$router.push({ path: '/walletlist' });
      },
      getallMoney: async function(){ //获取总收益余额
          let params = { id: localStorage.id}
          const res = await http.get(api.findIncome, params);
           	if (res.data.success) {
                this.allMoney = res.data.incomeVO.profit.toFixed(2);
                this.balance = res.data.incomeVO.balance.toFixed(2);
			 }else{
              this.$vux.toast.text(res.data.message, 'middle');
            }
      },
      getBalanceList:async function(){ //获取收益列表
           let params = { id: localStorage.id}
           const res = await http.get(api.findIncomeDetail, params);
           	if (res.data.success) {
                if(res.data.bnhDealerIncomeDetailVO.length == 0){
                    
                }else{
                  this.BalanceList;
                }
			 }else{
              this.$vux.toast.text(res.data.message, 'middle');
            }
      },
  }
}
</script>
<style scoped>
.bnh-wallet-container{position: relative}
.bnh-wallet-head{height: 3.33rem;background:#302d3e;text-align: center;padding-top: 0.67rem;color: #fff}
.allCont span{font-size: 0.6rem;font-weight: 600}
.bnh-yue-box{height: 3.44rem;width: 7.1rem;background: #fff;position: absolute;top: 1.75rem;left: 0.2rem;border-radius: 10px;box-shadow: 0px 5px 10px #f6f6f7;text-align: center}
.wallet-title{margin-top: 0.73rem;font-size: 0.32rem;color: #666}
.yue{margin-top: 1rem;color: #666}
.yue span{font-size: 0.62rem;color: #f17421;font-weight: 600}
.bnh-yue-btn{height: 0.93rem;width: 4.8rem;background: #ffaf3c;border-radius: 22px;color: #fff;position: absolute;top: 2.95rem;left: 1.1rem;}
.bnh-wallet-list{min-height: 1.24rem}
.bnh-list-head{height: 1.24rem;}
.bnh-pieBox-title{font-size: 0.36rem;color: #000;font-weight: bold;margin-left: 0.3rem}
.bnh-genduobox{font-weight: bold;margin-right: 0.3rem}
.bnh-genduobox > img{height: 0.28rem;width: auto;margin-left: 3px}
.bnh-list-item{height: 1.24rem;}
.leixin{margin-left: 0.3rem;font-size: 0.32rem;color: #666666}
.tipsBox{text-align: right;margin-right: 0.3rem;color: #999999}
.tipsBox .wallet-cont{font-size: 0.36rem;line-height: 0.2rem;color: #f17421}
</style>